package com.cjkj.system.mapper;

import com.cjkj.system.domain.THospitalEquipment;
import com.cjkj.system.domain.dto.HospitalEquipmentOptionsParam;
import com.cjkj.system.domain.dto.HospitalEquipmentReq;
import com.cjkj.system.domain.vo.HospitalEquipmentOptionsVo;
import com.cjkj.system.domain.vo.HospitalEquipmentVo;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 医院分配的设备Mapper接口
 * 
 * @author cjkj
 * @date 2024-08-30
 */
public interface THospitalEquipmentMapper 
{

    /**
     * 查询医院分配的设备
     *
     * @param equipmentId 设备信息主键
     * @return 医院分配的设备
     */
    THospitalEquipment selectByEquipmentId(String equipmentId);

    int updateEquipmentStatus(THospitalEquipment equipment);

    int updateEquipmentUseStatus(THospitalEquipment equipment);

    List<HospitalEquipmentVo> selectEquipmentList(HospitalEquipmentReq req);

    THospitalEquipment selectByIdAndHosId(@Param("id") Long id, @Param("hospitalId") String hospitalId);

    /**
     * 分配设备
     *
     * @param tHospitalEquipment 医院分配的设备
     * @return 结果
     */
    int distributionEquipment(THospitalEquipment tHospitalEquipment);

    /**
     * 查询即将过期的设备
     * @param equipmentType
     * @param hospitalId
     * @param deptId
     * @return
     */
    @MapKey("equipmentNo")
    List<Map<String, Integer>> selectExpireData(@Param("equipmentType") String equipmentType,
                                                @Param("hospitalId") String hospitalId,
                                                @Param("deptId") String deptId);

    /**
     * 查询故障的设备
     * @param equipmentType
     * @param hospitalId
     * @param deptId
     * @return
     */
    @MapKey("equipmentNo")
    List<Map<String, String>> selectFaultyEquipment(@Param("equipmentType") String equipmentType,
                                                    @Param("hospitalId") String hospitalId,
                                                    @Param("deptId") String deptId);

    List<HospitalEquipmentOptionsVo> selectEquipmentOptionData(HospitalEquipmentOptionsParam param);

    /**
     * 查询医院分配的设备
     * 
     * @param id 医院分配的设备主键
     * @return 医院分配的设备
     */
    THospitalEquipment selectTHospitalEquipmentById(Long id);

    /**
     * 修改医院分配的设备
     * 
     * @param tHospitalEquipment 医院分配的设备
     * @return 结果
     */
    int updateTHospitalEquipment(THospitalEquipment tHospitalEquipment);

    /**
     * 根据部门ID查询
     * @param deptId
     * @return
     */
    List<THospitalEquipment> selectByDept(String deptId);

}
